package cn.ht.jywrwater.module.ht.dal.mysql.devicedata;

import java.util.*;

import cn.ht.jywrwater.framework.common.pojo.PageResult;
import cn.ht.jywrwater.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ht.jywrwater.framework.mybatis.core.mapper.BaseMapperX;
import cn.ht.jywrwater.module.ht.dal.dataobject.devicedata.DeviceDataDO;
import org.apache.ibatis.annotations.Mapper;
import cn.ht.jywrwater.module.ht.controller.admin.devicedata.vo.*;

/**
 * 设备数据 Mapper
 *
 * @author hzx
 */
@Mapper
public interface DeviceDataMapper extends BaseMapperX<DeviceDataDO> {

    default PageResult<DeviceDataDO> selectPage(DeviceDataPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DeviceDataDO>()
                .eqIfPresent(DeviceDataDO::getDeviceCode, reqVO.getDeviceCode())
                .betweenIfPresent(DeviceDataDO::getDataTime, reqVO.getDataTime())
                .orderByDesc(DeviceDataDO::getId));
    }

    default List<DeviceDataDO> selectList(DeviceDataExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<DeviceDataDO>()
                .eqIfPresent(DeviceDataDO::getDeviceCode, reqVO.getDeviceCode())
                .betweenIfPresent(DeviceDataDO::getDataTime, reqVO.getDataTime())
                .orderByDesc(DeviceDataDO::getId));
    }

}
